(function(IMG){
    var Data={
        souceData:[]
    };

    Data.getAllBase64=function(callBack){
        var pics=$(".ant-upload-list-picture-card");        
        Data.souceData=[];
        $(pics).each(function(index,item){          
             var img=JSON.parse($(this).attr("imagesdata"));
             Data.souceData.push(img);
             if(index==pics.length-1){
                    callBack(Data.souceData);
             }             
        })       
    }

    Data.upLoad=function(url,meataName,callBack){
        Data.getAllBase64(function(data){
            var dataRs=[];
            for(var i=0;i<data.length;i++){
                dataRs.push(JSON.parse('{"'+meataName+'":"'+data[i].src+'"}'));
            }   
            console.log(dataRs);  
            $.post(url,dataRs,callBack);            
        });
    }

    Data.AddImageDataToForm=function(form,dataName){
         Data.getAllBase64(function(data){
           // var formData = new FormData(form);          
            for(var i=0;i<data.length;i++){
                //formData.append(dataName,data[i].src);          
               // dataRs.push(JSON.parse('{"'+dataName+'":"'+data[i].src+'"}'));
               appenDataToForm(form,dataName,data[i].src)
            }            
        });
    }

    function appenDataToForm(form,name,data){
        var input='<input name="{name}" type="hidden" value="{value}"/>';
        input=input.replace("{name}",name);
        input=input.replace("{value}",data);
        $(form).append(input);
    }
    
    Data.Base64ToBlob=function(dataurl){
         var arr = dataurl.split(','), mime = arr[0].match(/:(.*?);/)[1],
            bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n);
        while(n--){
            u8arr[n] = bstr.charCodeAt(n);
        }
        FileUpLoad.option.fileName="1."+mime.substring(mime.lastIndexOf("/")+1);
        console.log(FileUpLoad.option.fileName);
        return new Blob([u8arr], {type:mime});
    }

    


IMG.Data=Data;
})(window.imageUpLoad)